﻿<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.researchsubject.domain.*" pageEncoding="UTF-8"%>
<%@page import="com.hs.core.page.PageUtil,com.hs.core.utils.*"%>
<%@page import="cn.ac.cintcm.dataconverge.util.Constants"%>
<%@page import="com.hs.core.db.DBOperator;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
PageUtil pageUtil = (PageUtil)request.getAttribute("subjectList");
List resultList = null;
String pageStr = ""; 
int perpageCount = 1;
int currentPage = 1;
if(null != pageUtil){
   resultList = pageUtil.getPageList();
   pageStr = pageUtil.getPageStr();
   perpageCount = pageUtil.getNumberPerPage();
   currentPage = pageUtil.getCurrentPage();
}
String missItem = (String)request.getAttribute("missItem"); 
String orderName = (String)request.getAttribute("orderName");
String orderNum = (String)request.getAttribute("orderNum"); 
DBOperator dbo = new DBOperator(request.getSession().getServletContext());

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>课题信息</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <link href="<%=path%>/index/Themes/com/style.css" rel="stylesheet" type="text/css" /> 
    <script src="<%=path%>/index/Scripts/Script.js" language="javascript" type="text/javascript"></script>
     <script src="<%=path%>/js/common.js" language="javascript" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
    <script language="javascript" type="text/javascript">
         
       function searchSubject(){ 
       	
       			searchform.submit();			
       }
    </script>
 
</head>
<body class="rtm_body" scroll=yes>
<form name="searchform" action = "<%=path%>/subjectSearch.htm?action=searchSubject" method="post">
    <div class="r_rtm_tb_mg1">
        <div class="r_rtm_tb1">
            <span>
                <img src="<%=path%>/index/Themes/com/idt_tb_pass.gif" />&nbsp;&nbsp;课题缺失信息查询</span>
        </div>
    </div>     
     <table cellspacing="2" cellpadding="0" width="100%" class="idt_item_mg" id="Table2">
        <tr>
            <td class="fim_l" align="center" width="20%">
                课题缺失信息</td>
            <td class="fim_r" width="30%">
            <select name="missItem" style="width:100%">
	            <option value="fund" <%if("fund".equals(missItem)) {out.print(" selected");}%>>课题经费</option>
				<option value="document" <%if("document".equals(missItem)) {out.print(" selected");}%>>相关文档</option>
				<option value="researcher" <%if("researcher".equals(missItem)) {out.print(" selected");}%>>参与人员</option>
				<option value="original" <%if("original".equals(missItem)) {out.print(" selected");}%>>课题来源</option>
			</select>
			</td> 
			 <td class="fim_r" align="center"  >
                <input type="button" value="查询"  onclick="searchSubject()" class="com_btn2" id="Button5">
               
            </td>
        </tr> 
        </form>
    </table> 
   
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr>
            <td>
                <div class="content"> 
                    <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                        <tr>
                            <td class="dg_headerstyle" width="5%">
                                序号</td>
                            <td class="dg_headerstyle" width="10%">
                                 <a href="javaScript:orderPage('snumber','<%=OrderTool.getOrderNum("snumber",orderName,orderNum)%>');">课题编号&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("snumber",orderName,orderNum))%></a></td>
                            <td class="dg_headerstyle" width="20%">
                                <a href="javaScript:orderPage('subjectname','<%=OrderTool.getOrderNum("subjectname",orderName,orderNum)%>');">课题名称&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("subjectname",orderName,orderNum))%></a></td>
                            <td class="dg_headerstyle" width="10%">
                                 <a href="javaScript:orderPage('state','<%=OrderTool.getOrderNum("state",orderName,orderNum)%>');">当前状态&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("state",orderName,orderNum))%></a></td>
                            <td class="dg_headerstyle">
                                牵头单位</td>
                                 <td class="dg_headerstyle">
                                部门</td>
                            <td class="dg_headerstyle">
                                负责人</td>
                            <td class="dg_headerstyle">
                                课题来源</td>
                                  <td class="dg_headerstyle" width="10%">
                                 <a href="javaScript:orderPage('startdate','<%=OrderTool.getOrderNum("startdate",orderName,orderNum)%>');">计划开始日期&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("startdate",orderName,orderNum))%></a></td>
                                  <td class="dg_headerstyle" width="10%">
                                 <a href="javaScript:orderPage('enddate','<%=OrderTool.getOrderNum("enddate",orderName,orderNum)%>');">计划结束日期&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("enddate",orderName,orderNum))%></a></td>
                        </tr>
                        <%if(null != resultList && resultList.size()> 0){
                            for(int i = 0;i < resultList.size();i++){
                                    Subject obj = (Subject)resultList.get(i); 
                         %>
                        <tr class="dg_alternatingitemstyle" onmouseover="ChangeRowBg(this);" onmouseout="ChangeRowBg(this);" onmouseup="ChangeRowBg(this);" onmousedown="ChangeRowBg(this);">
                            <td align="center" width="3%"><%= perpageCount*(currentPage-1)+i+1 %></td>
                            <td align="center" width="8%">
                             <%=StringUtilTool.NULL2Blank(obj.getSnumber()) %>
                            </td>
                            <td width="20%">
                                 <a href="#"   onclick="openwindow('<%=path %>/subjectToAdd.htm?action=viewSubject&id=<%=obj.getId() %>','','','')"> <%=StringUtilTool.NULL2Blank(obj.getSubjectname()) %></a>
                            </td>
                            <td align="center">
                                <font color="red"><%=Constants.getSubjectStatus(obj.getState()) %></font>
                            </td>
                            <td width="15%">
                                <%
                                   if(obj != null){
                                     Set orgs = obj.getSubOrg();
                                     Iterator it = orgs.iterator();
                                     int h = 0;
                                     while(it.hasNext()){
                                    	 h++;
                                         SubOrg org = (SubOrg)it.next();
                                         if(null != org && Constants.org_role_leader.equals(org.getOrgRole()+""))
                                         	out.println(org.getOrg().getName()+"&nbsp;"); 
                                     }
                                   } 
                                 %>
                            </td>
                            <td width="10%">
                                <%
                                   if(obj != null){
                                     Set orgs = obj.getSubOrg();
                                     Iterator it = orgs.iterator();
                                     int h = 0;
                                     while(it.hasNext()){
                                    	 h++;
                                         SubOrg org = (SubOrg)it.next();
                                         if(null != org &&Constants.org_role_leader.equals(org.getOrgRole()+"")){
                                        	 Long deptId = org.getDeptId();
                                        	 List list = dbo.select("select name from RESMAN_DEPARTMENT where id="+deptId,null);
                                        	 if(list.size()>0){
                                        		 Map m = (Map)list.get(0);
                                        		 out.print(m.get("NAME")+"&nbsp;");
                                        	 }
                                         }
                                          
                                         
                                     }
                                   } 
                                 %>
                            </td>
                              <td width="10%">
                               <%
                                   if(obj != null){
                                     Set res = obj.getSubRes();
                                     Iterator it = res.iterator();
                                     int j = 0;
                                     while(it.hasNext()){
                                    	
                                         SubRes rearcher = (SubRes)it.next();
                                         if(Constants.researcher_role_chargeman.equals(rearcher.getResRole()+"")){
                                        	 j++;
                                        	 out.println(rearcher.getRes()==null?"":rearcher.getRes().getName()+"&nbsp;"); 
                                         }
                                        // if(j>1)
                                        //	 out.println(",");
                                     }
                                   } 
                                 %></td>
                            <td width="13%">
                                 <%
                                   if(obj != null){
                                     Set tags = obj.getTags();
                                     Iterator ittag = tags.iterator();
                                     while(ittag.hasNext()){
                                    	 SubTag tag = (SubTag)ittag.next();
                                         if(null != tag && tag.getTag() != null && tag.getTag().getTagType() == 1)
                                         	out.println( tag.getTag().getName());
                                     }
                                   } 
                                 %>
                            </td>
                             
                            <td width="6%">
                                <%=Tools.getDateStringByDate1(obj.getStartdate()) %>
                            </td> 
                            <td width="6%">
                                 <%=Tools.getDateStringByDate1(obj.getEnddate()) %>
                            </td> 
                        </tr> 
                        <%}}else{%>
                         <tr class="dg_alternatingitemstyle"> 
                            <td align="center" colspan=12>
                                <font color="red">没有找到记录</font>
                            </td> 
                        </tr> 
                        <%}%>
                    </table> 
                    <div class="dg_pagerstyle" align="right"> 
                            <%=pageStr %>  
                    </div> 
                </div>
            </td>
        </tr>
    </table>
</body>
</html>
